//
//  BuildDetailModel.m
//  Tospur-text
//
//  Created by  grogue on 15/10/9.
//  Copyright © 2015年 Tospur_hewei. All rights reserved.
//

#import "BuildDetailModel.h"
#import "BuildDeatilImageModel.h"
#import <objc/runtime.h>
@implementation BuildDetailModel
-(instancetype)init{
    self = [super init];
    if (self) {
        unsigned int propertyCount = 0;
        objc_property_t *propertys = class_copyPropertyList([self class], &propertyCount);
        for (int i = 0; i < propertyCount; i ++) {
            objc_property_t property = propertys[i];
            const char * propertyName = property_getName(property);
            SEL selector = NSSelectorFromString([NSString stringWithUTF8String:propertyName]);
            
            
                [self setValue:@"" forKey:[NSString stringWithUTF8String:propertyName]];
        }
    }
    return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues{
    id object;
    for (NSString *key in [keyedValues allKeys]) {
        if([key isEqualToString:@"GardenImgList"]){
            BuildDeatilImageModel *imageModel;
            NSMutableArray *array = [NSMutableArray array];
            for (NSDictionary *dict in [keyedValues objectForKey:key]) {
                imageModel = [[BuildDeatilImageModel alloc]init];
                [imageModel setValuesForKeysWithDictionary:dict];
                [array addObject:imageModel];
            }
            object = array;
        }
        else{
            object = [keyedValues objectForKey:key];
        }
        if(!object)
            object = @"";
        [self setValue:object forKey:key];
    }
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
@end
